package com.aisile.sellergoods.service.impl;

import com.aisile.mapper.TbItemCatMapper;
import com.aisile.pojo.TbItemCat;
import com.aisile.pojo.TbItemCatExample;
import com.aisile.sellergoods.service.ItemCatService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @标题 ItemCatServiceImpl
 * @作者 Mr.chen
 * @创建日期 2019/1/3 10:33
 * @版本号 1.0
 **/
@Service
public class ItemCatServiceImpl implements ItemCatService {
    @Autowired
    TbItemCatMapper tbItemCatMapper;


    @Override
    public List<TbItemCat> findByParentId(long parentId) {
        TbItemCatExample tbItemCatExample = new TbItemCatExample();
        tbItemCatExample.createCriteria().andParentIdEqualTo(parentId);
        return  tbItemCatMapper.selectByExample(tbItemCatExample);
    }

    @Override
    public TbItemCat findOne(long id) {
        return tbItemCatMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<TbItemCat> findAll() {
        return tbItemCatMapper.selectByExample(null);
    }
}
